<?php

// +----------------------------------------------------------------------
// | EasyAdmin
// +----------------------------------------------------------------------
// | PHP交流群: 763822524
// +----------------------------------------------------------------------
// | 开源协议  https://mit-license.org 
// +----------------------------------------------------------------------
// | github开源项目：https://github.com/zhongshaofa/EasyAdmin
// +----------------------------------------------------------------------

namespace app\admin\model;


use app\common\model\TimeModel;

class SystemAdmin extends TimeModel
{
    protected $name = "system_admin";
    protected $deleteTime = 'delete_time';

    public function getStatusTextAttr($value, $data)
    {

        return $data['status'] == 1 ? "启用": "禁用";
    }
    public function getAuthIdsTextAttr($value, $data)
    {
        $authList = SystemAuth::where('status',1)->column('title','id');
        return $authList[$data['auth_ids']];
    }
//    protected function getStatusAttr($value) {
//        $text = [1 => '启用', 0 => '警用'];
//
//        return $text[$value];
//        return ['val'=>$value,'text'=>$text[$value]];
//    }


    public function getAuthList()
    {
        $list = (new SystemAuth())
            ->where('status', 1)
            ->order('id','desc')
            ->column('title', 'id');
        return $list;
    }

}